package com.example.springmvcdemo;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

//Post请求的方式
@RequestMapping("/requestPost")
@RestController
public class requestPost {
    //第一种 报错
//    @RequestMapping("/index", "POST")
//    public String postReq(String req){
//        return req;
//    }

    //第二种 报错
//    @RequestMapping("/index",method = RequestMethod.POST)
//    public String postReq(String index1){
//        return index1;
//    }

    @RequestMapping(value = "/index",method = RequestMethod.POST)
    public String postReq1(String index1){
        return index1;
    }

//    @RequestMapping(value = "/index")
//    public String postReq3(String index1){
//        return index1;
//    }

    @PostMapping("/index1")
    public String postReq2(String index1){
        return index1;
    }
}
